﻿using System;
using System.Collections.Generic;
using System.Text;

namespace EventsSample
{
    public class CarDealer
    {
        public void NewCar(string car)
        {
            Console.WriteLine($"车商, 新车： {car}");

            NewCarInfo?.Invoke(this, new CarInfoEventArgs(car));
        }
        public event EventHandler<CarInfoEventArgs> NewCarInfo; //事件处理器
    }
    public class CarInfoEventArgs : EventArgs//事件处理接口
    {
        public string Car { get; }
        public CarInfoEventArgs(string car) => Car = car;


    }
}
